#!/usr/bin/env python
# vi: et sw=2
#
# Gnome PulseAudio applet
# Copyright (C) 2009  Harry Karvonen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#
# Author: Harry Karvonen <harry.karvonen@gmail.com>
#         Aki Rautio <aki.rautio@gmail.com>
#

import pygtk
pygtk.require("2.0");

import gtk
import gobject
import gnomeapplet
import sys
sys.path.append("/home/hate/git/gnome-pa-applet-2/pulse_interface")
sys.path.append("/home/hate/git/gnome-pa-applet-2/gnome_pulse_applet")

from PulseApplet import PulseApplet

# Keep it simple!

def gnome_pulse_applet_factory(applet, iid):
  PulseApplet(applet, iid)
  return True

if len(sys.argv) == 2 and sys.argv[1] == "window":   
  main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
  main_window.set_title("GnomePulseApplet2")
  main_window.connect("destroy", gtk.main_quit) 
  app = gnomeapplet.Applet()
  gnome_pulse_applet_factory(app, None)
  app.reparent(main_window)
  main_window.show_all()
  gtk.main()
  sys.exit()
else:
  #sys.stdout = open("/tmp/pulse-applet-out.log", "w")
  #sys.stderr = open("/tmp/pulse-applet-err.log", "w")

  gnomeapplet.bonobo_factory("OAFIID:GNOME_PulseApplet2_Factory", 
                             gnomeapplet.Applet.__gtype__, 
                             "GnomePulseApplet2",
                             "0",
                             gnome_pulse_applet_factory)

